import request from '@/utils/request'

// 查询收货订单列表
export function listReceiptOrder(query) {
  return request({
    url: '/wms/receiptOrder/list',
    method: 'get',
    params: query
  })
}

// 查询收货订单详细
export function getReceiptOrder(orderId) {
  return request({
    url: '/wms/receiptOrder/' + orderId,
    method: 'get'
  })
}

// 根据订单编号查询收货订单详细
export function getReceiptOrderByNo(orderNo) {
  return request({
    url: '/wms/receiptOrder/orderNo/' + orderNo,
    method: 'get'
  })
}

// 新增收货订单
export function addReceiptOrder(data) {
  return request({
    url: '/wms/receiptOrder',
    method: 'post',
    data: data
  })
}

// 创建收货订单
export function createReceiptOrder(data) {
  return request({
    url: '/wms/receiptOrder/create',
    method: 'post',
    data: data
  })
}

// 修改收货订单
export function updateReceiptOrder(data) {
  return request({
    url: '/wms/receiptOrder',
    method: 'put',
    data: data
  })
}

// 删除收货订单
export function delReceiptOrder(orderIds) {
  return request({
    url: '/wms/receiptOrder/' + orderIds,
    method: 'delete'
  })
}

// 收货确认
export function confirmReceipt(data) {
  return request({
    url: '/wms/receiptOrder/confirm',
    method: 'post',
    data: data
  })
}

// 取消收货订单
export function cancelReceiptOrder(orderId) {
  return request({
    url: '/wms/receiptOrder/cancel/' + orderId,
    method: 'put'
  })
}

// 完成收货订单
export function completeReceiptOrder(orderId) {
  return request({
    url: '/wms/receiptOrder/complete/' + orderId,
    method: 'put'
  })
}

// 生成订单编号
export function generateOrderNo(ownerId) {
  return request({
    url: '/wms/orderNumberRule/generate/' + ownerId + '/INBOUND',
    method: 'post'
  })
}

// 获取推荐库位
export function getRecommendedLocation(itemId, warehouseId) {
  return request({
    url: '/wms/location/recommended/' + itemId + '/' + warehouseId,
    method: 'get'
  })
}